在ThreeJS中一共有三个关于相机的JS文件,Camera.js、OrthographicCamera.js、PerspectiveCamera.js,分别是普通的相机、正交、正投影的相机、第三人称相机
首先是普通的相机,Camera.js
THREE
.
Camera
=
function
()
{
if
(
arguments
.
length
)
{
console
.
warn
(
'DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera().'
);
return
new
THREE
.
PerspectiveCamera
(
arguments
[
0
],
arguments
[
1
],
arguments
[
2
],
arguments
[
3
]
);
}
THREE
.
Object3D
.
call
(
this
);
this
.
matrixWorldInverse
=
new
THREE
.
Matrix4
();
this
.
projectionMatrix
=
new
THREE
.
Matrix4
();
this
.
projectionMatrixInverse
=
new
THREE
.
Matrix4
();
};
THREE
.
Camera
.
prototype
=
new
THREE
.
Object3D
();
THREE
.
Camera
.
prototype
.
constructor
=
THREE
.
Camera
;
THREE
.
Camera
.
prototype
.
lookAt
=
function
(
vector
)
{
// TODO: Add hierarchy support.
this
.
matrix
.
lookAt
(
this
.
position
,
vector
,
this
.
up
);
if
(
this
.
rotationAutoUpdate
)
{
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
);
}
};
camera里面有四个参数:camera(fov,aspect,near,far)
fov:垂直方向的观察角度,也就是眼睛上下俯视的