-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
/
Camera.js
69 lines (37 loc) · 1.24 KB
/
Camera.js
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { WebGLCoordinateSystem } from '../constants.js';
import { Matrix4 } from '../math/Matrix4.js';
import { Object3D } from '../core/Object3D.js';
class Camera extends Object3D {
constructor() {
super();
this.isCamera = true;
this.type = 'Camera';
this.matrixWorldInverse = new Matrix4();
this.projectionMatrix = new Matrix4();
this.projectionMatrixInverse = new Matrix4();
this.coordinateSystem = WebGLCoordinateSystem;
}
copy( source, recursive ) {
super.copy( source, recursive );
this.matrixWorldInverse.copy( source.matrixWorldInverse );
this.projectionMatrix.copy( source.projectionMatrix );
this.projectionMatrixInverse.copy( source.projectionMatrixInverse );
this.coordinateSystem = source.coordinateSystem;
return this;
}
getWorldDirection( target ) {
return super.getWorldDirection( target ).negate();
}
updateMatrixWorld( force ) {
super.updateMatrixWorld( force );
this.matrixWorldInverse.copy( this.matrixWorld ).invert();
}
updateWorldMatrix( updateParents, updateChildren ) {
super.updateWorldMatrix( updateParents, updateChildren );
this.matrixWorldInverse.copy( this.matrixWorld ).invert();
}
clone() {
return new this.constructor().copy( this );
}
}
export { Camera };