本页内容

PerspectiveCamera QML Type

定义一个透视摄像机,用于查看3D场景的内容。更多...

Import Statement: import QtQuick3D
Inherits:

Camera

Inherited By:

FrustumCamera

属性

详细说明

Camera 定义了 3D 场景的内容如何投影到 2D 表面上,例如View3D 。一个场景至少需要一个Camera 才能将其内容可视化。

Camera 可以像场景中的其他空间Node 一样进行定位和旋转。Node 的位置和方向决定了Camera 在场景中的位置及其朝向。Camera 的默认方向是其前向量沿负 Z 轴方向,向上量沿正 Y 轴方向。

透视摄影投影图

PerspectiveCamera 是标准的Camera 类型。它能对场景进行逼真的投影,使远处的物体看起来更小。视锥体由fieldOfView 属性以及近裁剪面和远裁剪面定义。

以下示例在场景中坐标 [0, 200, 300] 处创建了一个 PerspectiveCamera,其视场角为 90 度,俯仰角为 30 度。

PerspectiveCamera {
    position: Qt.vector3d(0, 200, 300)
    eulerRotation.x: -30
    fieldOfView: 90
}

另请参阅 Qt Quick 3D - View3D 示例、OrthographicCamera 、FrustumCamera 以及CustomCamera 。

属性文档

clipFar : real

该属性定义了PerspectiveCamera 的锥体远裁剪平面。距离Camera 比远裁剪平面更远的几何体将不可见。

默认值为 10000.0。单位取决于用户的几何单位,且该值相对于全局摄像机位置。

clipNear : real

该属性定义了PerspectiveCamera 视锥体的近裁剪平面。距离Camera 比近裁剪平面更近的几何体将不可见。

默认值为 10.0。单位取决于用户的几何单位,且该值相对于全局摄像机位置。

fieldOfView : real

该属性以度为单位存储摄像机的视场角。根据fieldOfViewOrientation 属性是设置为PerspectiveCamera.Vertical 还是PerspectiveCamera.Horizontal ,该值可以是垂直视场角或水平视场角。

默认值为 60.0。

fieldOfViewOrientation : enumeration

该属性用于指定相机视场的方向。

常量描述
PerspectiveCamera.Vertical提供的视场为垂直视场,这意味着该视场是连接摄像机与视口顶部中心点的连线,与连接摄像机与视口底部中心点的连线之间的夹角。水平宽高比将进行调整以保持宽高比。
PerspectiveCamera.Horizontal提供的视场为水平视场,即视场是從摄像机到视口左侧中心的连线与从摄像机到视口右侧中心的连线之间的夹角。垂直宽高比将进行调整以保持宽高比。

默认值为PerspectiveCamera.Vertical 。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.