-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCamera.ts
48 lines (33 loc) · 1.11 KB
/
Camera.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import * as THREE from 'three';
import { PerspectiveCamera } from 'three';
import useDebug from '@/composables/useDebug';
export default class Camera {
// instance: PerspectiveCamera;
instance: any
animations: any
coordinates: any
lookTarget: any
controls: any
constructor(fov: number, width: number, near: number, far: number, height?: number) {
this.instance = new PerspectiveCamera(fov, width, near, far);
this.instance.position.x = 33
this.instance.position.y = 3.3
this.instance.position.z = 0
//this.instance = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 0, 10000 );
}
resize(cam) {
cam.aspect = window.innerWidth / window.innerHeight;
cam.updateProjectionMatrix();
}
tweak() {
const debug = useDebug();
const camera_page = debug.panel.addFolder({
title: 'Camera',
expanded: false,
});
camera_page.addInput(this.instance, 'position')
camera_page.addInput(this.instance, 'rotation')
camera_page.addInput(this.instance, 'zoom')
camera_page.addInput(this.instance, 'fov')
}
}