PerspectiveCamera QML Type

Defines a Perspective Camera for viewing the content of a 3D scene. More...

Import Statement: import QtQuick3D
Inherits:

Camera

Inherited By:

FrustumCamera

Properties

Detailed Description

A Camera defines how the content of the 3D scene is projected onto a 2D surface, such as a View3D. A scene needs at least one Camera in order to visualize its contents.

It is possible to position and rotate the Camera like any other spatial Node in the scene. The Node's location and orientation determines where the Camera is in the scene, and what direction it is facing. The default orientation of the Camera has its forward vector pointing along the negative Z axis and its up vector along the positive Y axis.

PerspectiveCamera is the standard Camera type. It gives a realistic projection of the scene, where distant objects are perceived as smaller. The frustum is defined by the fieldOfView property as well as near and far clip planes.

The following example creates a PerspectiveCamera at position [0, 200, 300] in the scene, a field of view of 90 degrees and with a 30 degree downward pitch.

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

See also Qt Quick 3D - View3D Example, OrthographicCamera, FrustumCamera, and CustomCamera.

Property Documentation

FieldOfViewOrientation : enumeration

This enum type specifies the orientation in which camera field of view is given.

ConstantDescription
PerspectiveCamera.VerticalThe provided field of view is vertical, meaning the field of view is the angle between the line traced from the camera to the center top of the viewport and the line from the camera to the center bottom of the viewport. The horizontal aspect ratio will be adjusted to maintain aspect ratio. This is the default orientation.
PerspectiveCamera.HorizontalThe provided field of view is horizontal, meaning the field of view is the angle between the line traced from the camera to the center left side of the viewport and the line from the camera to the center right side of the viewport. The vertical aspect ratio will be adjusted to maintain aspect ratio.

clipFar : real

This property defines the far clip plane of the PerspectiveCamera's frustum. Geometry which is further away from the Camera than the far clip plane will not be visible.

The default value is 10000.0.


clipNear : real

This property defines the near clip plane of the PerspectiveCamera's frustum. Geometry which is closer to the Camera than the near clip plane will not be visible.

The default value is 10.0.


fieldOfView : real

This property holds the field of view of the camera in degrees. This can be either the vertical or horizontal field of view depending on whether the fieldOfViewOrientation property is set to PerspectiveCamera.Vertical or PerspectiveCamera.Horizontal.

The default value is 60.0.


fieldOfViewOrientation : enumeration

This property determines if the field of view property reflects the vertical or the horizontal field of view.

It can be either of the following two values:

  • PerspectiveCamera.Vertical - The provided field of view is vertical, meaning the field of view is the angle between the line traced from the camera to the center top of the viewport and the line from the camera to the center bottom of the viewport. The horizontal aspect ratio will be adjusted to maintain aspect ratio. This is the default orientation.
  • PerspectiveCamera.Horizontal - The provided field of view is horizontal, meaning the field of view is the angle between the line traced from the camera to the center left side of the viewport and the line from the camera to the center right side of the viewport. The vertical aspect ratio will be adjusted to maintain aspect ratio.

The default value is PerspectiveCamera.Vertical.


© 2023 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.