Defines an abstract base for Cameras. 更多...
import 语句: | import QtQuick3D 1.15 |
继承: | |
继承者: |
A Camera is always necessary to view the content of a 3D scene. A camera defines how to project the content of a 3D scene into a 2D coordinate space, which can then be used on a 2D surface. When a camera is present in the scene it can be used to direct what is displayed in a View3D .
To determine the projection of this camera a high level API is provided. First it is possible to position this Camera like any other spatial Node in the scene. This determines where the Camera is in the scene, and what direction it is facing. The default direction of the camera is such that the forward vector is looking up the -Z axis, and the up direction vector is up the +Y axis. With this in mind any transformation applied to the camera as well as the transformations inherited from it's parent Nodes you can define exactly where and in what direction your camera is facing.
The second part of determining the projection of the camera is defining the frustum that defines the what parts of the scenes are visible, as well as how they are visible. The Camera subtypes provide multiple options to determine the shape of the Camera's frustum.
另请参阅 PerspectiveCamera , OrthographicCamera , FrustumCamera ,和 CustomCamera .
FieldOfViewOrientation : enumeration |
This enum type specifies the orientation in which camera field of view is given:
常量 | 描述 |
---|---|
Camera.Vertical
|
Camera field of view is vertical, i.e. aspect ratio is adjusted vertically. This is the default orientation. |
Camera.Horizontal
|
Camera field of view is horizontal, i.e. aspect ratio is adjusted horizontally. |
frustumCullingEnabled : bool |
When this property is
true
object outside the frustum will be culled, meaning they will not be rendered. By default this property is set to
false
, but for complex scene where a lot of the objects are outside the camera frustum it might be beneficial to enable frustum culling.
vector3d lookAt ( QtQuick3D::Node node ) |
Sets the rotation value of a camera to be directed at node .
该方法在 Qt 5.15 引入。
Sets the rotation value of a camera to be directed at scenePos .
该方法在 Qt 5.15 引入。
变换 viewportPos from viewport space (2D) into global scene space (3D). The x- and y-values of viewportPos must be normalized, with the top-left of the viewport being [0,0] and the bottom-right being [1,1]. The z-value should be the distance from the near side of the frustum (clipNear) into the scene in scene coordinates. If viewportPos cannot be mapped to a position in the scene, a position of [0, 0, 0] is returned.
另请参阅 mapToViewport and View3D.mapTo3DScene() .
变换 scenePos from global scene space (3D) into viewport space (2D). The returned position is normalized, with the top-left of the viewport being [0,0] and the bottom-right being [1,1]. The returned z-value will contain the distance from the near side of the frustum (clipNear) to scenePos in view coordinates. If the distance is negative, the point is behind camera. If scenePos cannot be mapped to a position in the viewport, a position of [0, 0, 0] is returned.
另请参阅 mapFromViewport() and View3D.mapFrom3DScene() .