QCamera Class
class Qt3DRender::QCameraThe QCamera class defines a view point through which the scene will be rendered. More...
| Header: | #include <Qt3DRender/QCamera> |
| qmake: | QT += 3drender |
| Since: | Qt 5.5 |
| Instantiated By: | Camera |
| Inherits: | Qt3DCore::QEntity |
This class was introduced in Qt 5.5.
Public Types
| enum | CameraTranslationOption { TranslateViewCenter, DontTranslateViewCenter } |
Properties
|
|
Public Functions
| float | aspectRatio() const |
| float | bottom() const |
| float | exposure() const |
| float | farPlane() const |
| float | fieldOfView() const |
| float | left() const |
| Qt3DRender::QCameraLens * | lens() const |
| float | nearPlane() const |
| QVector3D | position() const |
| QMatrix4x4 | projectionMatrix() const |
| QCameraLens::ProjectionType | projectionType() const |
| float | right() const |
| float | top() const |
| Qt3DCore::QTransform * | transform() const |
| QVector3D | upVector() const |
| QVector3D | viewCenter() const |
| QVector3D | viewVector() const |
Public Slots
| void | setAspectRatio(float aspectRatio) |
| void | setBottom(float bottom) |
| void | setExposure(float exposure) |
| void | setFarPlane(float farPlane) |
| void | setFieldOfView(float fieldOfView) |
| void | setLeft(float left) |
| void | setNearPlane(float nearPlane) |
| void | setPosition(const QVector3D &position) |
| void | setProjectionMatrix(const QMatrix4x4 &projectionMatrix) |
| void | setProjectionType(QCameraLens::ProjectionType type) |
| void | setRight(float right) |
| void | setTop(float top) |
| void | setUpVector(const QVector3D &upVector) |
| void | setViewCenter(const QVector3D &viewCenter) |
Signals
| void | aspectRatioChanged(float aspectRatio) |
| void | bottomChanged(float bottom) |
| void | exposureChanged(float exposure) |
| void | farPlaneChanged(float farPlane) |
| void | fieldOfViewChanged(float fieldOfView) |
| void | leftChanged(float left) |
| void | nearPlaneChanged(float nearPlane) |
| void | positionChanged(const QVector3D &position) |
| void | projectionMatrixChanged(const QMatrix4x4 &projectionMatrix) |
| void | projectionTypeChanged(QCameraLens::ProjectionType projectionType) |
| void | rightChanged(float right) |
| void | topChanged(float top) |
| void | upVectorChanged(const QVector3D &upVector) |
| void | viewCenterChanged(const QVector3D &viewCenter) |
| void | viewVectorChanged(const QVector3D &viewVector) |
Detailed Description
Member Type Documentation
enum QCamera::CameraTranslationOption
This enum specifies how camera view center is translated
| Constant | Value | Description |
|---|---|---|
Qt3DRender::QCamera::TranslateViewCenter | 0 | Translate the view center causing the view direction to remain the same |
Qt3DRender::QCamera::DontTranslateViewCenter | 1 | Don't translate the view center causing the view direction to change |
Property Documentation
aspectRatio : float
Holds the current aspect ratio.
Access functions:
| float | aspectRatio() const |
| void | setAspectRatio(float aspectRatio) |
Notifier signal:
| void | aspectRatioChanged(float aspectRatio) |
bottom : float
Holds the current bottom of the camera.
This property is only relevant when projectionType is QCameraLens::OrthographicProjection.
Access functions:
| float | bottom() const |
| void | setBottom(float bottom) |
Notifier signal:
| void | bottomChanged(float bottom) |
exposure : float
Holds the current exposure of the camera.
The default value is 0.0.
The MetalRoughMaterial in Qt 3D Extras is currently the only provided material that makes use of camera exposure. Negative values will cause the material to be darker, and positive values will cause it to be lighter.
Custom materials may choose to interpret the value differently.
Access functions:
| float | exposure() const |
| void | setExposure(float exposure) |
Notifier signal:
| void | exposureChanged(float exposure) |
farPlane : float
Holds the current camera far plane. Objects that are farther from the camera than the farPlane will not be rendered.
Access functions:
| float | farPlane() const |
| void | setFarPlane(float farPlane) |
Notifier signal:
| void | farPlaneChanged(float farPlane) |
fieldOfView : float
Holds the current vertical field of view in degrees.
Along with aspectRatio, this property determines how much of the scene is visible to the camera. In that respect you might think of it as analogous to choosing a wide angle (wide horizontal field of view) or telephoto (narrow horizontal field of view) lens depending on how much of a scene you want to capture.
fieldOfView is only relevant when projectionType is QCameraLens::PerspectiveProjection.
Access functions:
| float | fieldOfView() const |
| void | setFieldOfView(float fieldOfView) |
Notifier signal:
| void | fieldOfViewChanged(float fieldOfView) |
left : float
Holds the current left of the camera.
This property is only relevant when projectionType is QCameraLens::OrthographicProjection.
Access functions:
| float | left() const |
| void | setLeft(float left) |
Notifier signal:
| void | leftChanged(float left) |
lens : Qt3DRender::QCameraLens* const
Holds the Qt3DRender::QCameraLens component of the camera.
This property was introduced in Qt 5.14.
Access functions:
| Qt3DRender::QCameraLens * | lens() const |
nearPlane : float
Holds the current camera near plane. Objects that are closer to the camera than the nearPlane will not be rendered.
Access functions:
| float | nearPlane() const |
| void | setNearPlane(float nearPlane) |
Notifier signal:
| void | nearPlaneChanged(float nearPlane) |
position : QVector3D
Holds the camera's position in coordinates relative to the parent entity.
Access functions:
| QVector3D | position() const |
| void | setPosition(const QVector3D &position) |
Notifier signal:
| void | positionChanged(const QVector3D &position) |
projectionMatrix : QMatrix4x4
Holds the current projection matrix of the camera.
Access functions:
| QMatrix4x4 | projectionMatrix() const |
| void | setProjectionMatrix(const QMatrix4x4 &projectionMatrix) |
Notifier signal:
| void | projectionMatrixChanged(const QMatrix4x4 &projectionMatrix) |
projectionType : Qt3DRender::QCameraLens::ProjectionType
Holds the type of the camera projection. The default value is QCameraLens::PerspectiveProjection.
- QCameraLens::OrthographicProjection - Parallel lines appear parallel. Objects appear the same size regardless of distance.
- QCameraLens::PerspectiveProjection - Parallel lines appear to meet in the distance. Objects appear to shrink the farther they are from the camera.
- QCameraLens::FrustumProjection
- QCameraLens::CustomProjection
Access functions:
| QCameraLens::ProjectionType | projectionType() const |
| void | setProjectionType(QCameraLens::ProjectionType type) |
Notifier signal:
| void | projectionTypeChanged(QCameraLens::ProjectionType projectionType) |
See also Qt3DRender::QCameraLens::ProjectionType.
right : float
Holds the current right of the camera.
This property is only relevant when projectionType is QCameraLens::OrthographicProjection.
Access functions:
| float | right() const |
| void | setRight(float right) |
Notifier signal:
| void | rightChanged(float right) |
top : float
Holds the current top of the camera.
This property is only relevant when projectionType is QCameraLens::OrthographicProjection.
Access functions:
| float | top() const |
| void | setTop(float top) |
Notifier signal:
| void | topChanged(float top) |
transform : Qt3DCore::QTransform* const
Holds the Qt3DCore::QTransform component of the camera.
This property was introduced in Qt 5.14.
Access functions:
| Qt3DCore::QTransform * | transform() const |
upVector : QVector3D
Holds the camera's up vector in coordinates relative to the parent entity.
The up vector indicates which direction the top of the camera is facing. Think of taking a picture: after positioning yourself and pointing the camera at your target, you might rotate the camera left or right, giving you a portrait or landscape (or angled!) shot. upVector allows you to control this type of movement.
Access functions:
| QVector3D | upVector() const |
| void | setUpVector(const QVector3D &upVector) |
Notifier signal:
| void | upVectorChanged(const QVector3D &upVector) |
viewCenter : QVector3D
Holds the camera's view center in coordinates relative to the parent entity.
Intuitively, the viewCenter is the location the camera is pointing at.
Access functions:
| QVector3D | viewCenter() const |
| void | setViewCenter(const QVector3D &viewCenter) |
Notifier signal:
| void | viewCenterChanged(const QVector3D &viewCenter) |
viewVector : const QVector3D
Holds the camera's view vector in coordinates relative to the parent entity.
This vector decribes the displacement from the camera (position) to its target (viewCenter).
Access functions:
| QVector3D | viewVector() const |
Notifier signal:
| void | viewVectorChanged(const QVector3D &viewVector) |