BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

Matrix4.makePerspective()

描述

Matrix4.makePerspective()three.js 库中 Matrix4 类的方法之一。它用于根据摄像机的视锥体参数构建透视投影矩阵。

语法

Matrix4.makePerspective(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4

参数

  • left (number) :视锥体左侧面距离摄像机的距离。
  • right (number) :视锥体右侧面距离摄像机的距离。
  • bottom (number) :视锥体下方面距离摄像机的距离。
  • top (number) :视锥体上方面距离摄像机的距离。
  • near (number) :视锥体近处面距离摄像机的距离。
  • far (number) :视锥体远处面距离摄像机的距离。

返回值

Matrix4 :透视投影矩阵。

示例

const fov = 45;
const aspect = window.innerWidth / window.innerHeight;
const near = 0.1;
const far = 1000;
const cameraMatrix = new THREE.Matrix4().makePerspective(
  (fov / 2) * (Math.PI / 180),
  aspect,
  near,
  far
);

参考