CustomCamera QML Type
定义带有自定义投影矩阵的相机。更多
Import Statement: | import QtQuick3D |
Inherits: |
属性
- projection : matrix4x4
详细说明
Camera 定义了如何将三维场景的内容投射到二维表面(如View3D )上。一个场景至少需要一个Camera 才能将其内容可视化。
可以像场景中其他空间Node 一样定位和旋转Camera 。Node 的位置和方向决定了Camera 在场景中的位置和朝向。Camera 的默认方向是向前矢量沿负 Z 轴指向,向上矢量沿正 Y 轴指向。
CustomCamera 类型提供了一个可自由定制投影矩阵的Camera 。
下面的示例在场景中的 [0, 200, 300] 位置创建了一个 CustomCamera(自定义摄像机),其俯仰角为 30 度,投影矩阵基于自定义的近平面和远平面距离以及自定义的视场。
CustomCamera { position: Qt.vector3d(0, 200, 300) eulerRotation.x: -30 property real near: 10.0 property real far: 10000.0 property real fov: 60.0 * Math.PI / 180.0 projection: Qt.matrix4x4(Math.cos(fov / 2) / Math.sin(fov / 2) * (window.height / window.width), 0, 0, 0, 0, Math.cos(fov / 2) / Math.sin(fov / 2), 0, 0, 0, 0, -(near + far) / (far - near), -(2.0 * near * far) / (far - near), 0, 0, -1, 0); }
注意: 使用自定义摄像机时,某些抗锯齿模式(Temporal AA 和 Progressive AA)无法正确应用。
另请参阅 PerspectiveCamera,OrthographicCamera, 和FrustumCamera 。
属性文档
projection : matrix4x4 |
该属性定义了CustomCamera 的投影矩阵。
© 2025 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.