aboutsummaryrefslogtreecommitdiffstats
path: root/src/user/index.ts
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-08-14 14:36:02 +0200
committerLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-08-14 14:36:02 +0200
commit35793aead3977bed574faa307b17a55dc0ad9ee7 (patch)
tree0b266a0aea6e05906c2bb82980b7424fb3a5511e /src/user/index.ts
parent445dba26c3636f1a0695549a446e1d5a27eb87db (diff)
downloadvideotool-35793aead3977bed574faa307b17a55dc0ad9ee7.tar.gz
videotool-35793aead3977bed574faa307b17a55dc0ad9ee7.tar.bz2
videotool-35793aead3977bed574faa307b17a55dc0ad9ee7.tar.lz
videotool-35793aead3977bed574faa307b17a55dc0ad9ee7.zip

chore: move lazycell out of here (1/2)

Diffstat (limited to 'src/user/index.ts')
-rw-r--r--src/user/index.ts20
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() { }