diff options
Diffstat (limited to 'src/user/index.ts')
-rw-r--r-- | src/user/index.ts | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/user/index.ts b/src/user/index.ts index b4f0501..c6969c3 100644 --- a/src/user/index.ts +++ b/src/user/index.ts @@ -1,8 +1,8 @@ import { type FrameTime, type InitConfig } from '$/lib/Player/Video'; -import ThreeVideo, { OnceCell } from './ThreeVideo'; +import ThreeVideo from './ThreeVideo'; import AudioURL from './03. Lemaitre, Jennie A. - Closer - 40sec version.flac?url' import * as THREE from 'three'; -import { RoundedBoxGeometry } from 'three/examples/jsm/geometries/RoundedBoxGeometry.js'; +import { LazyCell } from '$/lib/vendor/lazy-cell'; type FontInfo = { family: string, size: number, weight?: number @@ -64,17 +64,17 @@ export default class Video extends ThreeVideo { const rs = await threeInit if (rs && rs[0] === 1) { console.error(rs[1]); throw new Error('Failed to initialize ThreeJS!'); } } - protected uiGeometry = OnceCell(() => new THREE.BoxGeometry(0.1, 5, 7)); - protected uiDarkMaterial = OnceCell(() => new THREE.MeshStandardMaterial({ + protected uiGeometry = new LazyCell(() => new THREE.BoxGeometry(0.1, 5, 7)); + protected uiDarkMaterial = new LazyCell(() => new THREE.MeshStandardMaterial({ roughness: 0.8, color: 0xffffff, metalness: 0.2, bumpScale: 1 })); - protected uiDark = OnceCell(() => new THREE.Mesh(this.uiGeometry, this.uiDarkMaterial)) - protected uiLightMaterial = OnceCell(() => new THREE.MeshBasicMaterial({ color: 0x000000 })) - protected uiLight = OnceCell(() => new THREE.Mesh(this.uiGeometry, this.uiLightMaterial)) - protected lighting = OnceCell(() => { + protected uiDark = new LazyCell(() => new THREE.Mesh(this.uiGeometry, this.uiDarkMaterial)) + protected uiLightMaterial = new LazyCell(() => new THREE.MeshBasicMaterial({ color: 0x000000 })) + protected uiLight = new LazyCell(() => new THREE.Mesh(this.uiGeometry, this.uiLightMaterial)) + protected lighting = new LazyCell(() => { const dirLight = new THREE.DirectionalLight(0xffffff, 3); dirLight.castShadow = true; dirLight.shadow.camera.top = 0; @@ -93,13 +93,13 @@ export default class Video extends ThreeVideo { return dirLight; }) - protected uiCanvas = OnceCell(() => { + protected uiCanvas = new LazyCell(() => { const c = document.createElement('canvas'); c.width = this.px(1000); c.height = c.width / 5 * 7; return c; }); - protected uiCanvasCtx = OnceCell(() => this.uiCanvas.getContext('2d', { + protected uiCanvasCtx = new LazyCell(() => this.uiCanvas.getContext('2d', { alpha: true, })) protected drawUiCanvas() { } |